package com.fr.privilege.ui;

import com.fr.base.StringUtils;
import com.fr.base.XMLable;
import com.fr.base.core.json.JSONException;
import com.fr.base.core.json.JSONObject;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;
import com.fr.web.core.JSONReader;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public abstract class LoginoutUI
  implements XMLable, JSONReader
{
  public static final String XML_TAG = "LoginoutUI";
  protected String autoRedirect;

  public abstract void redirect2LoginUI(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, String paramString)
    throws Exception;

  public abstract String createURL(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, String paramString)
    throws Exception;

  public String getAutoRedirect()
  {
    return this.autoRedirect;
  }

  public void setAutoRedirect(String paramString)
  {
    this.autoRedirect = paramString;
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    if (paramXMLableReader.isChildNode())
    {
      String str = paramXMLableReader.getTagName();
      if (str.equals("LoginoutAttr"))
        this.autoRedirect = paramXMLableReader.getAttr("autoredirect");
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    if (StringUtils.isNotEmpty(this.autoRedirect))
    {
      paramXMLPrintWriter.startTAG("LoginoutAttr").attr("autoredirect", this.autoRedirect);
      paramXMLPrintWriter.end();
    }
  }

  public void readJSON(JSONObject paramJSONObject)
    throws JSONException
  {
    setAutoRedirect(paramJSONObject.getString("autoredirect"));
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    return super.clone();
  }
}